home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / WINPROGS / UPC12BS2.ZIP / TEST / TESTIMP.C < prev    next >
C/C++ Source or Header  |  1992-11-22  |  3KB  |  103 lines

  1. /*--------------------------------------------------------------------*/
  2. /*       Program:    testimp     06/09/91                             */
  3. /*       Author:     Andrew H. Derbyshire                             */
  4. /*       Function:   Test UUPC/extended filename mapping              */
  5. /*                   functions                                        */
  6. /*                                                                    */
  7. /*       Copyright (C) 1991, Andrew H. Derbyshire                     */
  8. /*--------------------------------------------------------------------*/
  9.  
  10. /*--------------------------------------------------------------------*/
  11. /*                        System include files                        */
  12. /*--------------------------------------------------------------------*/
  13.  
  14. #include <stdio.h>
  15. #include <stdarg.h>
  16. #include <assert.h>
  17. #include <stdlib.h>
  18. #include <string.h>
  19.  
  20. /*--------------------------------------------------------------------*/
  21. /*                    UUPC/extended include files                     */
  22. /*--------------------------------------------------------------------*/
  23.  
  24. #include "lib.h"
  25. #include "import.h"
  26. #include "export.h"
  27. #include "timestmp.h"
  28.  
  29. /*--------------------------------------------------------------------*/
  30. /*                          Local variables                           */
  31. /*--------------------------------------------------------------------*/
  32.  
  33. char *E_nodename = "kendra";
  34. char *panic_string = "Program aborting at line %d in file %s";
  35. char *E_charset = DOSCHARS;
  36. char *E_spooldir = "c:\uupc\spool";
  37.  
  38. /*--------------------------------------------------------------------*/
  39. /*    m a i n                                                         */
  40. /*                                                                    */
  41. /*    Main program to test importpath()                               */
  42. /*--------------------------------------------------------------------*/
  43.  
  44. void main( int argc , char **argv )
  45. {
  46.    char canon[FILENAME_MAX];
  47.    char host[FILENAME_MAX];
  48.    size_t count;
  49.  
  50.    banner( argv );            /* Out of habit, I guess               */
  51.    assert( argc > 2 );
  52.  
  53.    for( count = 2; count < argc; count++)
  54.    {
  55.       printf("main: Processing arg[%d]=\"%s\"\n",
  56.                count, argv[count] );
  57.       importpath( canon, argv[count], argv[1] );
  58.  
  59.       printf("import remote(%s)\thost(%s)\t yields canon(%s)\n",
  60.                argv[1],
  61.                argv[count] ,
  62.                canon);
  63.  
  64.       fflush( stdout );
  65.  
  66.       if ( strchr( argv[count], '/' ) == NULL )
  67.       {
  68.          exportpath( host, canon,  argv[ 1 ] );
  69.  
  70.          printf("export remote(%s)\tcanon(%s)\t yields host(%s)\n",
  71.                argv[1],
  72.                canon,
  73.                host );
  74.       } /* if */
  75.  
  76.    } /* for */
  77.  
  78. } /* main */
  79.  
  80. /*--------------------------------------------------------------------*/
  81. /*           Replacement for UUPC/extended logging function           */
  82. /*--------------------------------------------------------------------*/
  83.  
  84. #pragma argsused
  85.  
  86. void printmsg(int level, char *fmt, ...)
  87. {
  88.    va_list arg_ptr;
  89.  
  90.    va_start(arg_ptr,fmt);
  91.    vfprintf(stdout, fmt, arg_ptr);
  92.    putchar('\n');
  93. }
  94.  
  95.  
  96. void bugout( const size_t lineno, const char *fname )
  97. {
  98.    printmsg(0,"Program aborting at line %d in file %s",
  99.               lineno, fname );
  100.    fcloseall();
  101.    exit(69);
  102. } /*bugout */
  103.